<?php

namespace app\common\base;

/**
 * Class BaseService 所有service的基类
 *
 * @package App\Services
 * @author wangshenghong
 * @date 2024.03.01
 */
class BaseService {

    /**
     * 单例
     *
     * @var
     */
    private static $instance;

    /**
     * 错误码
     *
     * @var
     */
    public static $errorCode = 0;

    /**
     * 错误信息
     *
     * @var string
     */
    public static $errorMsg = '';

    public static function gi() {
        if(!self::$instance instanceof static){
            self::$instance = new static();
        }
        return self::$instance;
    }

    /**
     * 获取错误码
     *
     * @return int
     */
    public function getErrorCode() {
        return self::$errorCode;
    }

    /**
     * 获取业务逻辑里的错误信息
     */
    public function getErrorMsg() {
        return self::$errorMsg;
    }
}
